{	Problem: http://codeforces.ru/problemset/problem/68/A
	Verdict: Accepted
}
var p1,p2,p3,p4,a,b,r,i:longint;
begin
r:=0;
read(p1,p2,p3,p4,a,b);
for i:=a to b do
  if i mod p1 mod p2 mod p3 mod p4=i then inc(r);
write(r);
end.